package com.xzk.utillibary.comman;

import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Build;
import android.support.v7.graphics.Palette;
import android.view.View;

/**
 * Created by Administrator on 2018/3/21 0021.
 */

public class PaletteTest {

    public static void paletteTest(Bitmap bitmap, final View... iv){

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
//            getWindow().setStatusBarColor(color);
        Palette.generateAsync(bitmap, new Palette.PaletteAsyncListener() {
            public void onGenerated(Palette palette) {
                //柔和的
                iv[0].setBackgroundColor(palette.getMutedColor(Color.BLUE));//设置默认颜色
                //鲜艳的暗色
                iv[1].setBackgroundColor(palette.getDarkMutedColor(Color.BLUE));
                //柔和的亮色
                iv[2].setBackgroundColor(palette.getLightMutedColor(Color.BLUE));
                //鲜艳的
                iv[3].setBackgroundColor(palette.getVibrantColor(Color.BLUE));
                //鲜艳的暗色
                iv[4].setBackgroundColor(palette.getDarkVibrantColor(Color.BLUE));
                //鲜艳的亮色
                iv[5].setBackgroundColor(palette.getLightVibrantColor(Color.BLUE));
            }

        });
    }

}
